package dtd.PHS.VND_ExchangeRate;

import java.util.Locale;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class MyMainMenu {
	Context context;
	public MyMainMenu(Context context) {
		this.context = context;
	}
	public void createOptionsMenu(Menu menu) {
		MenuInflater inflater = ((Activity)context).getMenuInflater();
		inflater.inflate(R.menu.main_menu, menu);		
	}
	public boolean onItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menu_about_us:
			Intent intent = new Intent(this.context,About.class);
			context.startActivity(intent);
			return true;
		case R.id.menu_language_vi:
			MyUtility.saveLanguageOption(context,"vi");
			MyUtility.changeLanguage(context,"vi");
			MyUtility.forceActivityRestart((Activity)context);
			return true;
		case R.id.menu_language_en:
			MyUtility.saveLanguageOption(context,"en");
			MyUtility.changeLanguage(context,"en");
			MyUtility.forceActivityRestart((Activity)context);
			return true;
		case R.id.menu_exit:
			MyUtility.switchToHomeScreen((Activity)context);
			return true;
		default: return false;
		}
	}

}
